Worst-Case Lookup and Tree Buckets
Good hash distribution normally keeps bucket sizes small.
Treeification protects against pathological collision chains in some implementations.
Tree-based buckets can provide O(log k) lookup within a bucket.
Treeification has additional memory and comparison overhead.
The exact thresholds and implementation strategy are library-specific.
This optimization does not mean all Hash Table operations are unconditionally O(log n); expected behavior remains approximately O(1).